{extend name="./oscshop/admin/view/public/base.html" /}
{block name="content"}
<div class="page-header">
	<h1>	
		{$breadcrumb1}
		<small>
			<i class="ace-icon fa fa-angle-double-right"></i>
			{$breadcrumb4}
		</small>
	</h1>
</div>

	
<table class="table table-striped table-bordered table-hover search-form">
	<thead>
		<th>
			<input name="user_name" type="text" placeholder="输入会员手机号码" value="{:input('param.user_name')}" />
			&nbsp;&nbsp;
			开始时间<input name="begin_day" type="date" placeholder="输入开始时间" value="{:input('param.begin_day')}" />
			&nbsp;&nbsp;
			结束时间<input name="end_day" type="date" placeholder="输入结束时间" value="{:input('param.end_day')}" />
			&nbsp;&nbsp;
			<select name="exchange_id" id ="exchange_id"   tabindex="4">
				<option value ="">请选择交易所</option>
				{volist name="exchange" id="p" empty="$exchange"}
				<option value ="{$p.id}" {if condition="$p.id eq input('exchange_id')"} selected="selected" {/if}>{$p.name}</option>
				{/volist}
			</select>
			<select name="variety_id" id ="variety_id"   tabindex="4">
				<option value ="">请选择交易品种</option>
			</select>
			&nbsp;&nbsp;
			<a class="btn btn-primary" href="javascript:;" id="search" url="{:url('ContractOne/end_list')}">查询</a>
			<a class="btn btn-primary" href="{:url('ContractOne/end_list')}" >清空查询</a>
		</th>
	</thead>
</table>	
	
<div class="row">
	<div class="col-xs-12">	
		<div class="table-responsive">
			<table class="table table-striped table-bordered table-hover">
				<thead>
					<tr>
						<th>ID</th>
						<th>用户</th>
						<th>姓名</th>
						<th>申请金额</th>
						<th>抵扣金额</th>
						<th>抵扣方式</th>
						<th>合约开始时间</th>
						<th>合约结束时间</th>
						<th>交易所</th>
						<th>交易品种</th>
						<th>买入枚数</th>
						<th>买入价</th>
						<th>卖出枚数</th>
						<th>卖出价</th>
						<th>买入状态</th>
						<th width="8%">异常申请备注</th>
						<th>操作</th>
					</tr>
				</thead>
				<tbody>
						{volist name="list" id="v"}
						<tr>
							<td>{$v.id}</td>
							<td>{$v.username}</td>
							<td>{:get_member_idcardname($v.username)}</td>
							<td>{$v.money}</td>
							<td>{$v.price}</td>
							<td>{if condition="$v.type eq 1"}金豆{else}元宝{/if}</td>
							<td>{$v.begin_day}</td>
							<td>{$v.end_day}</td>
							<td>{:get_trade_name($v.exchange)}</td>
							<td>{:get_variety_name($v.exchange_variety)}</td>
							<td>{$v.b_num}</td>
							<td>{$v.b_price}</td>
							<td>{$v.s_num}</td>
							<td>{$v.s_price}</td>
							<td>{if condition="$v.buy_state eq 0"}未审核{elseif condition="$v.buy_state eq 1"}已审核{else}未通过{/if}</td>
							<td>{$v.abnormal_desc}</td>
							<td>
								<a class="btn btn-primary" href="/admin/free/end_info?id={$v.id}">审批操作</a>
							</td>
						</tr>
						{/volist}	
				</tbody>
			</table>
			{$page}
		</div>
	</div>
</div>
{/block}
{block name="javascript"}
<script>	
$(function(){
   $("#search").click(function () {
        var url = $(this).attr('url');
        var query = $('.search-form').find('input,select').serialize();
        query = query.replace(/(&|^)(\w*?\d*?\-*?_*?)*?=?((?=&)|(?=$))/g, '');
        query = query.replace(/^&/g, '');
        if (url.indexOf('?') > 0) {
            url += '&' + query;
        } else {
            url += '?' + query;
        }
        window.location.href = url;
    });	
});
</script>
<script type="text/javascript">
	$('#exchange_id').change(function(){
		var iframe_array = <?php echo  json_encode($variety);   ?>;
		var checkValue=jQuery("#exchange_id").val();
		$("#variety_id").empty();
		for (var i = 0; i <iframe_array.length ; i++)
		{
			if(iframe_array[i]['exchange_id']==checkValue)
			{
				var opt = "<option value='"+iframe_array[i]['id']+"'>"+iframe_array[i]['name']+"</option>";
				jQuery("#variety_id").append(opt);
			}
		}

	})
</script>
{/block}